<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">    
<title>签到</title>
<link rel="stylesheet" href="css/bootstrap3/css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/qiandao_style.css">
	<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
	<script src="/js/jquery/jquery.min.js"></script>
    <link rel="stylesheet" href="/css/strategyCatalogs.css">
	<script src="/js/plugins/jquery-form/jquery.form.js"></script>
	<link rel="stylesheet" href="/js/plugins/dialog2/dialog.css">
	<script src="/js/plugins/dialog2/dialog.min.js"></script>
	<script src="/js/bootstrap/js/bootstrap.min.js"></script>
	<script src="js/calendar.js"></script>
</head>
<body>
<div class="search-head">
    <div class="row nav-search">
        <div class="col">
            <a href="javascript:history.go(-1);">
                <span><i class="fa fa-chevron-left"><<</i></span>
            </a>
        </div>
        <div class="col">
            <span>每日签到</span>
        </div>
        <div class="col"></div>
    </div>
</div>

<div class="container">
	<div class="row">
		<div class="col-xs-12 clearPadding">
			<div class=""><img src="/upload/jifen.jpg" class="img-responsive"></div>
			
			<div class="calendar">
				<div class="calenbox">
					<div id="calendar"></div>
				</div>
				<div class="text-center">
					<button class="btn btn-qiandao" id="signs" >马上签到</button><!--onClick="signIn()"-->
				</div>
			</div>
			<div class="padding10">
				<div class="font16 pb10 borderb"><strong>连续签到礼包</strong></div>
				<div class="libaolist">
					<div class="clearfix borderb ptb10">
						<div class="col-xs-9 clearPadding">
							<div class="media">
								<a class="media-left pt3" href="javascript:void(0);">
									<img src="images/dou.png" style="width:30px;height:30px;">
								</a>
								<div class="media-body">
									<div class="">3天礼包（20积分）</div>
									<div class="text-muted font12">连续签到3天即可领取</div>
								</div>
							</div>
						</div>
						<div class="col-xs-3 clearPadding text-right pt2">
							<button class="btn btn-disable" >已领取</button>
						</div>
					</div>
					<div class="clearfix borderb ptb10">
						<div class="col-xs-9 clearPadding">
							<div class="media">
								<a class="media-left pt3" href="javascript:void(0);">
									<img src="images/dou.png" style="width:30px;height:30px;">
								</a>
								<div class="media-body">
									<div class="">5天礼包（50积分）</div>
									<div class="text-muted font12">连续签到5天即可领取</div>
								</div>
							</div>
						</div>
						<div class="col-xs-3 clearPadding text-right pt2">
							<button class="btn btn-disable" id="take" >领取</button>
						</div>
					</div>
					<div class="clearfix borderb ptb10">
						<div class="col-xs-9 clearPadding">
							<div class="media">
								<a class="media-left pt3" href="javascript:void(0);">
									<img src="images/dou.png" style="width:30px;height:30px;">
								</a>
								<div class="media-body">
									<div class="">15天礼包（150积分）</div>
									<div class="text-muted font12" >连续签到15天即可领取</div>
								</div>
							</div>
						</div>
						<div class="col-xs-3 clearPadding text-right pt2">
							<button class="btn btn-disable" >领取</button>
						</div>
					</div>		
					<div class="clearfix borderb ptb10">
						<div class="col-xs-9 clearPadding">
							<div class="media">
								<a class="media-left pt3" href="javascript:void(0);">
									<img src="images/dou.png" style="width:30px;height:30px;">
								</a>
								<div class="media-body">
									<div class="">20天礼包（250积分）</div>
									<div class="text-muted font12" >连续签到20天即可领取</div>
								</div>
							</div>
						</div>
						<div class="col-xs-3 clearPadding text-right pt2">
							<button class="btn btn-disable" >领取</button>
						</div>
					</div>
					<div class="clearfix borderb ptb10">
						<div class="col-xs-9 clearPadding">
							<div class="media">
								<a class="media-left pt3" href="javascript:void(0);">
									<img src="images/dou.png" style="width:30px;height:30px;">
								</a>
								<div class="media-body">
									<div class="">25天礼包（300积分）</div>
									<div class="text-muted font12" >连续签到25天即可领取</div>
								</div>
							</div>
						</div>
						<div class="col-xs-3 clearPadding text-right pt2">
							<button class="btn btn-disable" >领取</button>
						</div>
					</div>
					<div class="clearfix borderb ptb10">
						<div class="col-xs-9 clearPadding">
							<div class="media">
								<a class="media-left pt3" href="javascript:void(0);">
									<img src="images/dou.png" style="width:30px;height:30px;">
								</a>
								<div class="media-body">
									<div class="">30天礼包（400积分）</div>
									<div class="text-muted font12">连续签到30天即可领取</div>
								</div>
							</div>
						</div>
						<div class="col-xs-3 clearPadding text-right pt2">
							<button class="btn btn-disable" >领取</button>
						</div>
					</div>																								
				</div>
			</div>
		</div>
	</div>
</div>
<div class="maskbox"></div>
<div class="qdbox">
	<div class="text-center text-green font18"><strong>签到成功！</strong></div>
	<div class="text-center pt10">您已经连续签到&nbsp;<span class="text-green" id="showDay"></span>&nbsp;天</div>
	<div class="text-center ptb15"><img src="images/gift.png" style="width:125px;margin-left:20px;"></div>
	<div class="text-center"><button class="btn btn-lottery">棒棒哒</button></div>
</div>

<script>
/*function  signIn(){
	$(".maskbox").fadeIn();
	$(".qdbox").fadeIn();
	$(".maskbox").height($(document).height());
}
$(".maskbox").click(function(){
	$(".maskbox").fadeOut();
	$(".qdbox").fadeOut();
});*/
$(function(){

    var signList = [];
    $.get("/sign",function (data) {
        console.log(data.days);

        $.each(data.days,function (index, ele) {
            signList.push({'signDay':ele})
        });
        console.log(signList);
        calUtil.init(signList);
    });


  	$("#signs").click(function () {

		$.post("/sign/time",function (data) {
            if(data.success){
                $.get("/sign",function (data) {
                    $.each(data.days,function (index, ele) {
                        signList.push({'signDay':ele})
                    });
                    calUtil.init(signList);
                    setTimeout(function () {
                        //location.reload();
                        $("#showDay").html(data.count);
                        $(".maskbox").fadeIn();
                        $(".qdbox").fadeIn();
                        $(".maskbox").height($(document).height());

                        $(".maskbox").click(function(){
                            $(".maskbox").fadeOut();
                            $(".qdbox").fadeOut();
                        })
                    },1000)
                    //判断连续签到天数
                    if(data.count==5){
                        $("#take").removeClass('btn-disable');
                        $("#take").addClass('btn-lingqu');
                    }
                })

            }else{
                $(document).dialog({
                    type: 'alert',
                    closeBtnShow: false,
                    content: data.msg
                })
            }


        })

    });

    /*$.get("/sign",function (data) {
        if (data.count == 5) {
            $("#take").removeClass('btn-disable');
            $("#take").addClass('btn-lingqu');
        }
    });*/

    $("#take").click(function () {
        if ($(this).hasClass('btn-lingqu')){
            location.href="/mine/profiles.html"
            $("#take").removeClass('btn-lingqu');
            $("#take").addClass('btn-disable');
        }

    })

});
</script>
</body>
</html>
